/**
 * Created by thinkl on 2017/6/19.
 */
$(function () {

    var app_data = {
        shopping_class_list: [],
        shopping_list: [],
    };

    var app = new Vue({
        el: '#app',
        data: app_data,
        methods: {
            get_class_commodity: function (class_id) {
                $.post('/shopping/query_classification_commodity', {classification_id: class_id}, function (data) {
                    var l = JSON.parse(data);
                    app_data.shopping_list = l.result
                })
            },
            go_shopping_com: function (commodity_id) {
                location.href = '/static/shopping_commodity/shopping_commodity.html?id=' + commodity_id
            }
        }
    });
    $.post('/commodity/query_commodity_class', {}, function (data) {
        var l = JSON.parse(data);
        app_data.shopping_class_list = l.result;
    });
});


function user_logout() {
    $.post('/login/user_logout', {}, function (data) {
        location.href = '/static/login/login.html'
    })
}